package com.ts.framework.utils;

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;

/**
 * Created by mrt on 2020/5/22.
 */
public class BCryptUtil {
      public static String encode(String password){
            PasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
            String hashPass = passwordEncoder.encode(password);
            return hashPass;
      }
      public static boolean matches(String password,String hashPass){
            PasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
            boolean f = passwordEncoder.matches(password, hashPass);
            return f;
      }
}
